package com.eightbears.beboy.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.R;
import com.eightbears.beboy.entity.ComplaintEntity;

/**
 * Created by Bao on 2016/12/7.
 */

public class ComplaintAdapter extends BaseQuickAdapter<ComplaintEntity, BaseViewHolder> {

    private int postion = 0;

    public ComplaintAdapter() {
        super(R.layout.item_complaint, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ComplaintEntity complanintEntity) {
        baseViewHolder.setText(R.id.tv_name, complanintEntity.getName())
            .addOnClickListener(R.id.ll_item);
        ImageView iv_icon = baseViewHolder.getView(R.id.iv_icon);
        iv_icon.setImageResource(R.mipmap.icon_weixuan);

        if(baseViewHolder.getLayoutPosition() == postion){
            iv_icon.setImageResource(R.mipmap.icon_xuanzhong);
        }
    }

    public void setIv_icon(int postion){
        this.postion = postion;
        notifyDataSetChanged();
    }
}
